﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.Toook.AutoDownloadHtml.DownloadHtml.NewsHtml;
using Com.Toook.AutoDownloadHtml.Entity;
using Com.Toook.AutoDownloadHtml.SaveData;

namespace Com.Toook.AutoDownloadHtml.DownloadHtml
{
    public class DownloadNews
    {
        public void GetNews()
        {
            NewsAbstract down = null;
            NewsUpdateObj obj = NewsSqlite.GetNewsUpdateObj();

            switch(obj.TypeSite.ToLower()){
                case "nativesohu" :
                    down = new SohuNative(obj.Url, obj.Charset);
                    break;
                case "financesohu":
                    down = new SohuFinance(obj.Url, obj.Charset);
                    break;
                case "milsohu":
                    down = new SohuMil(obj.Url, obj.Charset);
                    break;
                case "sportsohu":
                    down = new SohuSport(obj.Url, obj.Charset);
                    break;
                case "entsohu":
                    down = new SohuEnt(obj.Url, obj.Charset);
                    break;
                //case "fashionsohu":
                //    down = new SohuEnt(obj.Url, obj.Charset);
                //    break;
                case "socialsohu":
                    down = new SohuSocial(obj.Url, obj.Charset);
                    break;
                case "worldsohu":
                    down = new SohuWorld(obj.Url, obj.Charset);
                    break;
                default:
                    break;
            }
            down.DownloadNews();

            NewsSqlite.UpdateNewsUpdateObj(obj);//更新新闻分类到期时间
        }
    }
}
